package com.avocado.auth.server.controller;


import javax.annotation.Resource;

import com.avocado.commons.model.http.BaseResponse;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;




/**
 * 注销登录
 * @author xuwenfeng
 *
 */
@RestController
public class LogoutController {

     @Resource
     private ConsumerTokenServices consumerTokenServices;

     @RequestMapping("/oauth/consumer/token/revoke")
	 public @ResponseBody BaseResponse revoke(@RequestParam(value="access_token") String accessToken) {

		 consumerTokenServices.revokeToken(accessToken);

		 return BaseResponse.builder().status(1).build();
	 }


}
